export function formatTab (type,list) { 
  if(list){
    let arr=list.split('/') 
    if(type=='id'){ 
      return arr[0]
    }else if(type=='type'){
      return arr[1]
    } 
  }else{
    return '';
  } 
}

export function formatTime (date) {
  // const year = date.getFullYear()
  // const month = date.getMonth() + 1
  // const day = date.getDate()

  // const hour = date.getHours()
  // const minute = date.getMinutes()
  // const second = date.getSeconds()

  // const t1 = [year, month, day].map(formatNumber).join('/')
  // const t2 = [hour, minute, second].map(formatNumber).join(':')

  // return `${t1} ${t2}`
}

export function s_to_hs(s){ 
  var h;
  h  =   Math.floor(s/60);
  //计算秒
  //算法：取得秒%60的余数，既得到秒数
  s  =   s%60;
  //将变量转换为字符串
  h    +=    '';
  s    +=    '';
  //如果只有一位数，前面增加一个0
  h  =   (h.length==1)?'0'+h:h;
  s  =   (s.length==1)?'0'+s:s;
  return h+':'+s;
}

export default {
  formatTab, 
  s_to_hs
}
